import defaultProductImg from '@/assets/imgs/default-product-img.jpg' //默认商品图

export function useServiceUtils() {
  /**
   *
   * @param durationUnit 时间单位
   */
  const filterCardOptionTime = (durationUnit: any) => {
    let optionTimes = <any>[]
    if (durationUnit == 2) {
      optionTimes = [
        {
          dictName: '日',
          dictValue: 0
        },
        {
          dictName: '月',
          dictValue: 1
        },
        {
          dictName: '年',
          dictValue: 2
        }
      ]
    } else if (durationUnit == 1) {
      optionTimes = [
        {
          dictName: '日',
          dictValue: 0
        },
        {
          dictName: '月',
          dictValue: 1
        }
      ]
    } else if (durationUnit == 0) {
      optionTimes = [
        {
          dictName: '日',
          dictValue: 0
        }
      ]
    }
    return optionTimes
  }
  /**
   *
   * @param durationUnit 时间单位
   */
  const filterCardTime = (durationUnit: any) => {
    let optionTimeText = ''
    if (durationUnit == 2) {
      optionTimeText = '年'
    } else if (durationUnit == 1) {
      optionTimeText = '月'
    } else if (durationUnit == 0) {
      optionTimeText = '日'
    }
    return optionTimeText
  }

  return {
    filterCardOptionTime,
    filterCardTime,

    defaultProductImg
  }
}
